package com.fang.config;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Fang Ruichuan
 * @date 2023-01-07 22:00
 */
@Configuration
@RequiredArgsConstructor
public class InterceptorConfig implements WebMvcConfigurer {

    private final AccessLimiterInterceptor accessLimiterInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(accessLimiterInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/static/**", "login.html", "user/login");
    }
}
